Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pigeon] [swift] Changes PigeonError class to conform to Sendable. #8302

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

bc-lee
Copy link
Contributor

@bc-lee bc-lee commented Dec 15, 2024

Make PigeonError conform to Sendable for compatibility with Swift 6.0 mode by changing the details property type from Any? to Sendable?.

Fixes flutter/flutter#160313

Pre-launch Checklist

If you need help, consider asking for advice on the #hackers-new channel on Discord.

@hellohuanlin
Copy link
Contributor

This will break old sdk where Sendable is undefined. You may have to put it behind a flag.

@bc-lee
Copy link
Contributor Author

bc-lee commented Dec 15, 2024

This will break old sdk where Sendable is undefined. You may have to put it behind a flag.

Are there any minimum Xcode requirements for Flutter projects? Sendable was added in Xcode 13.0 with Swift 5.5.

@bc-lee
Copy link
Contributor Author

bc-lee commented Dec 15, 2024

I found the answer.

  • Flutter 3.12 or later requires Xcode 14.0 or newer.
    Source
  • Flutter 3.0 or later requires Xcode 13.0 or newer.
    Source

So, I think it is safe to use this in Pigeon, as Pigeon requires Dart 3.3 and Flutter 3.19.

@@ -1,6 +1,7 @@
## NEXT
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be updated to 22.7.1 along with the pubspec version and the generator_tools file.

I guess this is technically a breaking change, so 23.0.0 might be more correct.

@@ -1,6 +1,7 @@
## NEXT

* Updates minimum supported SDK version to Flutter 3.22/Dart 3.4.
* [swift] Make `PigeonError` Class Conform to `Sendable`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[swift] Changes `PigeonError` class to conform to `Sendable`.

@tarrinneal
Copy link
Contributor

@stuartmorgan shouldn't this pr be failing the test exemption check?

Copy link
Contributor

@hellohuanlin hellohuanlin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm after addressing the comments.

@bc-lee bc-lee changed the title [pigeon][swift] Make PigeonError Class Conform to Sendable [pigeon] [swift] Changes PigeonError class to conform to Sendable. Dec 19, 2024
@bc-lee bc-lee requested a review from tarrinneal December 19, 2024 22:56
Copy link
Contributor

@stuartmorgan stuartmorgan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@stuartmorgan shouldn't this pr be failing the test exemption check?

I think there's a false negative due to the changes to generated files in platform_tests; we should probably tune the Cocoon rules to ignore .gen. files in there.

Regardless, this does need testing. A Dart unit test should be fine for this for now (although long term we probably want to adjust the Swift integration tests to actually test a flow that ensures that everything is Sendable)

@bc-lee
Copy link
Contributor Author

bc-lee commented Dec 27, 2024

Regardless, this does need testing. A Dart unit test should be fine for this for now (although long term we probably want to adjust the Swift integration tests to actually test a flow that ensures that everything is Sendable)

I have added the Dart test introduced by this PR. I also agree that the long-term solution would involve updating the Swift integration tests—not just to check for @Sendable, but to cover all aspects related to Swift's strict concurrency model. However, I believe this would require additional setup.

@bc-lee bc-lee requested a review from stuartmorgan December 27, 2024 16:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[pigeon][swift] Make PigeonError Class Conform to Sendable
4 participants